package com.kuang.login.model;

import com.kuang.login.utils.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

/**
 * Created by 郭浩 on 2020/9/25 17:12
 */
public class UserMysqlModel {
    public static int register(User user) {
        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());
        try {
            queryRunner.update("insert into mvc values (null,?,?,?)",
                    user.getUsername(),user.getPassword(),user.getGender());
        } catch (SQLException throwables) {
            throwables.printStackTrace();
            return 404;
        }
        return 200;
    }
}
